<template>
	<view class="homeLayout">
		<view class="banner">
			<swiper :circular="true" :indicator-dots="true" 
			:autoplay="true" :interval="3000" :duration="1000">
				<swiper-item>
					<view class="swiper-item"><img src="../../common/images/banner1.jpg" alt="" mode="" /></view>
				</swiper-item>
				<swiper-item>
					<view class="swiper-item"><img src="../../common/images/banner2.jpg" alt="" mode="" /></view>
				</swiper-item>
			</swiper>
		</view>
		<view class="notice">
			<view class="left">
				<uni-icons type="sound-filled" size="20" color="#28b389"></uni-icons>
				<text class="text">公告</text>
			</view>
			<view class="center">
				<swiper :vertical="true" :indicator-dots="false" :autoplay="true" :interval="1500" :duration="300" :circular="true">
					<swiper-item>
						<view class="swiper-item">文字内容1文字内容1文字内容1文字内容1文字内容1文字内容1文字内容1文字内容1</view>
					</swiper-item>
					<swiper-item>
						<view class="swiper-item">文字内容2</view>
					</swiper-item>
				</swiper>				
			</view>
			<view class="right">
				<uni-icons type="right" size="16" color="#28b389"></uni-icons>
			</view>
		</view>
	</view>
	<view class="select">
		<common-title>
			<template #name>每日推荐</template>
			<template #custom>
				<view class="date">
					<uni-icons type="calendar" size="18" color="#28b389"></uni-icons>
					<view class="text">
						<uni-dateformat :date="Date.now()" format="dd日"></uni-dateformat>
					</view>
				</view>
			</template>
		</common-title>
		<view class="content">
			<scroll-view scroll-x="true" >
				<view class="box" v-for="item in 8">
					<image src="../../common/images/preview_small.webp" mode="aspectFill"></image>
				</view>
			</scroll-view>
		</view>
	</view>
	<view class="theme">
		<common-title>
			<template #name>
				专题精选
			</template>
			<template #custom>
				<navigator url="" class="more">More+</navigator>
			</template>
		</common-title>
		<view class="content">
			<theme-itme v-for="item in 8"></theme-itme>
			<theme-itme :isMore="true"></theme-itme>
		</view>
	</view>
</template>

<script setup>

</script>

<style lang="scss" scoped>
.homeLayout{
	.banner{
		width: 750rpx;
		padding: 30rpx 0;
		text-align: center;
		swiper{
			width: 750rpx;
			height: 340rpx;
			swiper-item{
				width: 100%;
				height: 100%;
				padding: 0 30rpx;
				img{
					width: 100%;
					height: 100%;
					border-radius: 10rpx;
					margin: 0 auto;
				}
				
			}
		
		}
		
	}
	.notice{
		width: 690rpx;
		height: 80rpx;
		background-color: lightgrey;
		line-height: 80rpx;
		//居中
		margin: 0 auto;
		border-radius: 80rpx;
		// 设置成一行
		display: flex;
		.left{
			width: 140rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			.text{
				color:#28b389;
				font-weight: 600;
				font-size: 28rpx;
				
			}
		}
		.right{
			width: 70rpx;;
			display: flex;
			align-items: center;
			justify-content: center;
		}
		.center{
			flex:1;
			swiper{
				//继承父亲高度
				height: 100%;
				swiper-item{
					  width: 100%;
					  height: 100%;
					  font-size: 30rpx;
					  color: #666;
					  overflow: hidden;
					  white-space: nowrap;
					  text-overflow: ellipsis; 
					  display: inline-block;
				}
			}
		}		
		
	}	
	
}
.select{
		padding-top: 50rpx;
		.content{
			width: 720rpx;
			margin-left: 20rpx;
			margin-top: 30rpx;			
			scroll-view{
				white-space: nowrap;
				.box{
					width: 200rpx;
					height: 440rpx;
					display: inline-block;
					margin-right: 15rpx;
					image{
						width: 100%;
						height: 100%;
						border-radius: 10rpx;
					}
					
				}
				.box: last-child{margin-right: 30rpx;}
			}
		}
		.date{
			color: #28b389;
			display: flex;
			// 同行对齐
			align-items: center;
			.text{
				margin-left: 5rpx;
			}
		}
	}
.theme{
	padding: 50rpx 0;
	.more{
		font-size: 32rpx;
		color: #888;
	}
	.content{
		margin-top: 30rpx;
		padding: 0 30rpx;
		display: grid;
		gap: 15rpx;
		// 显示一行三个宽度自动
		grid-template-columns: repeat(3,1fr);
	}
}
</style>
